package org.jks.util;


import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class GsonUtil {

	public static Object json2Object(String json, Class<?> classOfT) {
		Gson gson = new Gson();
		return gson.fromJson(json, classOfT);
	}

	public static String object2json(Object obj) {
		GsonBuilder b = new GsonBuilder();
		b.setDateFormat("yyyy-MM-dd HH:mm:ss.S");
		b.excludeFieldsWithoutExposeAnnotation();
		b.registerTypeAdapterFactory(HibernateProxyTypeAdapter.FACTORY);
		Gson gson = b.create();
		return gson.toJson(obj);
	}
	
}
